<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">


    <!-- Bootstrap core CSS -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="main.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <title>主服务页</title>
  <script type="text/javascript">
  </script>

  <body>
    
  <div id="app"  v-cloak>

    <div id="home" v-show="0 === svrid_page">
    <div>
        <form class="form-inline"><div class="form-group">
        <label>栏目选择:</label>
        <template v-for="item in colm_base">
        <div class="checkbox">
            <label> <input type="checkbox" :value="item" v-model="colm_checked"> {{item | attrName2Human}} </label>
        </div>
        </template>
        </div></form>
    </div>

    <table class="table table-striped" border="1">
      <tr style="cursor:pointer;">
        <template v-for="item in colm_base">
        <th v-if="colm_checked.indexOf(item) >= 0" @click="onSort(item,1)"> {{item | attrName2Human}} <span :class="spanclass(item) "></span> </th>
        </template>
        <th>详细</th>
      </tr>
      <template v-for="(cli,idx) in maindata">
      <tr>
        <template v-for="item in colm_base">
        <td v-if="colm_checked.indexOf(item) >= 0">{{cli[item] | value2Human(item)}}</td>
        </template>
        <td><a @click.prevent="gotoDetail(cli.svrid, idx)" :href="'#'+cli.svrid">详细</a></td>
      </tr>
      </template>
    </table>
    </div>

    <div v-if="svrid_page > 0">
        <div>
        <a href="#" @click.prevent="gotoDetail(0)" data-toggle="tooltip" title="返回客户列表"
            class="glyphicon glyphicon-arrow-left"> 返回
        </a>
        &nbsp;&nbsp;
        <a href="#"  @click.prevent="refreshDetail(svrid_page)">刷新</a>
        </div>
        <div class="panel panel-primary">
            
            <div class="panel-heading">
                <h3 class="panel-title">属性信息</h3>
            </div>
            <div class="panel-body">
                <form class="form-inline">
                    <div class="form-group" v-for="(value, key) in detail_obj">
                        <span v-if="key.indexOf('prvd_') === -1"
                            data-toggle="tooltip" :title="'原始属性: '+key+'='+value"> 
                        <label>{{key | attrName2Human}}:</label>

                        <input type="text" class="form-control" v-if="isReadOnly(key)"
                            :value="value | value2Human(key)" readonly>

                        <input type="text" class="form-control" v-else
                            :value="value | value2Human(key)"
                            @change="propChange($event, key, value)" >

                        &nbsp; &nbsp; 
                        </span>
                    </div>
                </form>
            </div>
        </div>

        <div class="panel panel-primary" v-if="'_provider_mark' in detail_obj">
            <div class="panel-heading">
                <h3 class="panel-title">服务提供</h3>
            </div>
            <div class="panel-body" v-for="svritem in prvd_obj">
                <form class="form-inline">
                    <div class="form-group" v-for="(value, key) in svritem">
                        <span>
                            <label>{{key}}:</label>
                            <input type="text" class="form-control" :value="value" readonly>
                            &nbsp; &nbsp;
                        </span>
                    </div>
                </form>
            </div>
        </div>

        <div class="panel panel-primary" v-if="Object.keys(invk_obj).length">
            <div class="panel-heading">
                <h3 class="panel-title">服务消费</h3>
            </div>
            <div class="panel-body">
                <table class="table">
                    <tr>
                        <th>服务名</th>
                        <th>svrid(prvdid)</th>
                        <th>成功次数</th>
                        <th>失败次数</th>
                    </tr>
                    <tr v-for="(val,key) in invk_obj">
                        <td>{{val.name}}</td>
                        <td>{{val.svrid}}({{val.prvdid}})</td>
                        <td>{{val.ivk_ok | filterNullStr}}</td>
                        <td>{{val.ivk_ng | filterNullStr}}</td>
                    </tr>
                </table>
            </div>
        </div>

        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">控制命令</h3>
            </div>
            <div class="panel-body" >
                <div class="container">
                    <div class="row"><div class="col-xs-4 col-md-6">
                    
                        <div class="btn-group btn-group-justified" role="group" aria-label="x">
                            <div class="btn-group" role="group">
                                <button type="button" class="btn btn-default"
                                    @click="refreshDetail(svrid_page)">刷新信息</button>
                            </div>
                            <div class="btn-group" role="group">
                                <button type="button" class="btn btn-default" 
                                    @click="checkAlive()">检查存活</button>
                            </div>
                            <div class="btn-group" role="group">
                                <button type="button" class="btn btn-default"
                                    @click="outtext=''">清空输出</button>
                            </div>
                        </div>
                    
                        <div class="btn-group btn-group-justified" role="group" aria-label="x">
                            <div class="btn-group" role="group">
                                <button type="button" class="btn btn-default"
                                    @click="clickClose(0)">通知关闭</button>
                            </div>
                            <div class="btn-group" role="group">
                                <button type="button" class="btn btn-default"
                                    @click="clickClose(1)">强制关闭</button>
                            </div>
                            <div class="btn-group" role="group">
                                <button type="button" class="btn btn-default"
                                    @click="clickClose(2)">断开Link</button>
                            </div>
                        </div>
                    
                        <div class="btn-group btn-group-justified" role="group" aria-label="x">
                            <div class="btn-group" role="group">
                                <button type="button" class="btn btn-default"
                                    @click="checkIOStat">IO统计</button>
                            </div>
                            <div class="btn-group" role="group">
                                <button type="button" class="btn btn-default"
                                    @click="checkCpuInfo(1)">CPU负载</button>
                            </div>
                            <div class="btn-group" role="group">
                                <button type="button" class="btn btn-default"
                                    @click="checkCpuInfo(2)">内存状况</button>
                            </div>
                        </div>
                    
                    </div>
                        <div class="col-xs-8 col-md-6">
                            <textarea  v-model="outtext" class="resptxt_style"
                                placeholder="此处显示命令执行结果" width="100%">
                            </textarea>
                        </div>
                    </div>
                  </div>
            </div>
        </div>
    </div>


  </div>
  

  </body>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script>
  <script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>

  <script src="main.js"></script>
</html>